package svgedit.gui.commands;

import svgedit.gui.controlpoints.ControlPoint;

/**
 * Handles the resizing of elements on the document,
 * handles the control points
 * @author SARJ
 *
 */
public class ResizeCommand implements Command
{
	// The old posistion
	private float oldx;
	private float oldy;
	
	// The new posisiton
	private float newx;
	private float newy;
	
    private ControlPoint newp;
    
    /**
     * Construct the resize command and prepare its properties
     * @param x The current x
     * @param y The current y of control point
     * @param newp The new control point
     */
    public ResizeCommand(float x, float y, ControlPoint newp){
    	this.oldx = x;
    	this.oldy = y;
    	
    	this.newx = newp.getX();
    	this.newy = newp.getY();
    	
    	this.newp = newp;
	
    }
    
    @Override
    public void executeRedo()
    {
    	newp.set(newx, newy);
	
    }

    @Override
    public void executeUndo()
    {
    	newp.set(oldx, oldy);
    }
}
